//
//  LLUser.swift
//  WeiBoShiBing
//
//  Created by Bingo on 15/10/31.
//  Copyright © 2015年 Bingo. All rights reserved.
//

import UIKit

class LLUser: NSObject {
    
    var idstr:String?
    
    var name:String?
    
    var profile_image_url:String?
    
    var verified_type:Int = -1
    
    var verifiedTypeImage:UIImage?{
        switch verified_type{
        case 0:
            return UIImage(named: "avatar_vip")
        case 2,3,5:
            return UIImage(named: "avatar_enterprise_vip")
        case 220:
            return UIImage(named: "avatar_grassroot")
        default:
            return nil
        }
    }
    
    var mbrank: Int = 0
    
    var mbrankImage:UIImage?{
        if mbrank > 0 && mbrank <= 6{
            return UIImage(named: "common_icon_membership_level\(mbrank)")
        }
        return nil
    }
    
    init(dict:[String:AnyObject]){
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    //字典的key在模型中找不到的时候必须实现这个方法
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    //对象的打印
    override var description:String{
        let properties = ["idstr", "name", "profile_image_url", "verified_type", "mbrank"]
        
        return "\n\t用户模型：\( dictionaryWithValuesForKeys(properties))"
    }
}
